package live.sidian.database.synchronizer.sync.data.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @author sidian
 * @date 2021/4/15 19:58
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Column {
    /**
     * 列名
     */
    String name;
    /**
     * 类的类型.
     *
     * @see java.sql.Types
     */
    int type;
    /**
     * 列的值
     */
    Object value;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Column column = (Column) o;
        return type == column.type && Objects.equals(name, column.name) && Objects.equals(value, column.value);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, type, value);
    }
}
